package cn.bsb.service.backstage;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import cn.bsb.dao.ArticleMapper;
import cn.bsb.pojo.Article;
@Service
public class ArticleService {
	@Autowired
	private ArticleMapper article;
	
	//文章列表
	public List<Article> getList(){
		return article.getList();
	}
	
	//文章分页
	public PageInfo<Article> getPage(int pageNum,int pageSize){
		PageHelper.startPage(pageNum, pageSize);
		List<Article> list = article.getList();
		PageInfo<Article> page = new PageInfo<Article>(list);
		return page;
	}
	
	//查询文章
	public List<Article> getList(String title){
		return article.getSelectList(title);
	}
	//删除
	public int delete(Long id) {
		return article.deleteArticle(id);
	}
	
	
	
	//查看
	public Article getOne(Long id) {
		return article.getArticle(id);
	}
	//删除专题时将该专题下的文章转存到“其他”专题下
	public int updateThematicid(Long thematic_id) {
		return article.updateThematicid(thematic_id);
	}
}
